
#ifndef Velyn_Rock_h
#define Velyn_Rock_h

#include "SubdivisionSurface.h"
#include "Displacement.h"

namespace Velyn {
    
    class Rock : public Subdivisions::SubdivisionSurface {
        
    public:
        
        Rock(string texture, string material) : Subdivisions::SubdivisionSurface(texture, material) {}
        
        ~Rock() {}
        
        void sperical(int numberIterations) {
            Displacements::Displacement displacement(Displacements::Displacement::SPHERICAL, numberSubdivisions);
            
            for(int iteration = 0; iteration < numberIterations; iteration++) {
                subdivideSurface();
                displacement.displace(mesh);
            }
        }
        
        // FIXME: add params to this to specify the growth
        void noise(int numberIterations) {
            // displacement = new Noise(numberSubdivisions, 0.3f);
            Displacements::Displacement displacement(Displacements::Displacement::NOISE, numberSubdivisions);
            
            for(int iteration = 0; iteration < numberIterations; iteration++) {
                subdivideSurface();
                displacement.displace(mesh);
            }
        }
        
        void slice(int numberIterations) {
            Displacements::Displacement displacement(Displacements::Displacement::SLICE, numberSubdivisions);
            
            for(int iteration = 0; iteration < numberIterations; iteration++) {
                displacement.displace(mesh);
            }
        }
        
        void smooth(int numberIterations) {
            for(int iteration = 0; iteration < numberIterations; iteration++) {
                smoothSurface();
            }
        }
        
        // FIXME: this does not work
        /* void superUnion() {
         reset();
         
         vector<IDisplacement*>::iterator displacementIterator;
         
         for(displacementIterator = appliedDisplacements.begin();
         displacementIterator != appliedDisplacements.end() - 1;
         displacementIterator++) {
         
         // displacement = *displacementIterator;
         
         // displacement->displace(mesh);
         
         numberSubdivisions++;
         }
         } */

    };

}

#endif
